package com.lincoln.entity.user;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.lincoln.entity.base.BaseEntity;
import lombok.*;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

//以User为基础的扩展表,有自己的主键
@Data
@Entity(name="user_account")
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })//转json忽略参数
public class DbUserAccount extends BaseEntity {
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id",nullable = false)
    @NotFound(action = NotFoundAction.IGNORE)
    protected DbUser user;

    //昵称
    @Column(name="nick_name",columnDefinition = "varchar(50)",length = 50,nullable = false)
    protected String nickName;

    //积分
    @Column(name="score",columnDefinition = "int(8) default 0",length = 8)
    protected Integer score;

    //状态
    @Column(name="state",columnDefinition = "int(1) default 0",length = 1)
    protected Integer state;

}
